
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 0846
 * @Author : WangRuoyu 
 * @Date : 2023/5/21 19:59
 */

#include "iostream"

using namespace std;

const int N = 1e5 + 10;
const int M = 2e5 + 10;
int h[N];
int e[M];
int ne[M];
int idx = 0;
int n;
bool st[N];

int res = 0x3f3f3f3f;

void add(int a, int b) {
    e[idx] = b;
    ne[idx] = h[a];
    h[a] = idx++;
}

int dfs(int u) {
    st[u] = true;
    int sum = 1;
    int ans = 0;
    for (int i = h[u]; i != -1; i = ne[i]) {
        int j = e[i];
        if (!st[j]) {
            int k = dfs(j);
            ans = max(ans, k);
            sum += k;
        }
    }
    ans = max(n - sum, ans);
    res = min(ans, res);
    return sum;
}

int main() {
    scanf("%d", &n);

    for (int &i: h) {
        i = -1;
    }

    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        add(a, b);
        add(b, a);
    }

    dfs(1);

    printf("%d", res);

    return 0;
}